<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <style>
        :root {
            --primary-color: #2196f3;
            --secondary-color: #666;
            --border-color: #e0e0e0;
            --background-color: #f8f9fa;
            --hover-color: #1976d2;
            --error-color: #f44336;
            --success-color: #4caf50;
        }

        body {
            width: 380px;
            padding: 20px;
            margin: 0;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            background: #fff;
            color: #333;
        }

        .section {
            margin-bottom: 24px;
            border-radius: 12px;
            background: var(--background-color);
            padding: 16px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            transition: all 0.2s ease;
        }

        .section:hover {
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }

        .section:last-child {
            margin-bottom: 0;
        }

        .section-title {
            font-size: 15px;
            font-weight: 600;
            color: #1a1a1a;
            margin-bottom: 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-bottom: 8px;
            border-bottom: 2px solid var(--border-color);
        }

        .shortcuts {
            background: #fff;
            border-radius: 8px;
            padding: 12px;
        }

        .shortcut-item {
            display: flex;
            align-items: center;
            margin-bottom: 12px;
            padding: 8px;
            background: #fff;
            border-radius: 6px;
            transition: all 0.2s ease;
        }

        .shortcut-item:hover {
            background: var(--background-color);
        }

        .shortcut-keys {
            display: flex;
            gap: 4px;
            margin-right: 12px;
        }

        .key {
            background: #fff;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 4px 8px;
            font-size: 12px;
            color: var(--secondary-color);
            box-shadow: 0 2px 2px rgba(0,0,0,0.05);
            transition: all 0.2s ease;
        }

        .shortcut-desc {
            font-size: 13px;
            color: var(--secondary-color);
        }

        .video-info {
            background: #fff;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 16px;
        }

        .video-title {
            font-size: 14px;
            font-weight: 500;
            color: #1a1a1a;
            margin-bottom: 12px;
            line-height: 1.4;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .video-meta {
            display: flex;
            align-items: center;
            gap: 16px;
            font-size: 12px;
            color: var(--secondary-color);
        }

        .settings-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 16px;
            background: #fff;
            padding: 12px;
            border-radius: 8px;
        }

        .setting-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 8px;
            border-radius: 6px;
            transition: all 0.2s ease;
        }

        .setting-item:hover {
            background: rgba(0,0,0,0.02);
        }

        .setting-label {
            font-size: 13px;
            color: #333;
            font-weight: 500;
        }

        select, input {
            padding: 6px 12px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            font-size: 13px;
            color: #333;
            background: #fff;
            transition: all 0.2s ease;
            min-width: 120px;
        }

        select:hover, input:hover {
            border-color: var(--primary-color);
        }

        select:focus, input:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(33,150,243,0.1);
        }

        .history-list {
            display: grid;
            gap: 12px;
            max-height: 300px;
            overflow-y: auto;
            padding: 4px;
            scrollbar-width: thin;
            scrollbar-color: var(--border-color) transparent;
        }

        .history-list::-webkit-scrollbar {
            width: 6px;
        }

        .history-list::-webkit-scrollbar-track {
            background: transparent;
        }

        .history-list::-webkit-scrollbar-thumb {
            background-color: var(--border-color);
            border-radius: 3px;
        }

        .history-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            background: #fff;
            border-radius: 8px;
            transition: all 0.2s ease;
            border: 1px solid var(--border-color);
        }

        .history-item:hover {
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            transform: translateY(-1px);
        }

        .history-thumbnail {
            width: 100px;
            height: 56px;
            object-fit: cover;
            border-radius: 6px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        .history-info {
            flex: 1;
            min-width: 0;
        }

        .history-title {
            font-size: 13px;
            color: #333;
            margin-bottom: 6px;
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .history-time {
            font-size: 12px;
            color: var(--secondary-color);
        }

        .history-actions {
            display: flex;
            gap: 8px;
        }

        .history-button {
            padding: 6px 12px;
            font-size: 12px;
            border: none;
            border-radius: 6px;
            background: var(--primary-color);
            color: #fff;
            cursor: pointer;
            transition: all 0.2s ease;
            font-weight: 500;
        }

        .history-button:hover {
            background: var(--hover-color);
            transform: translateY(-1px);
        }

        .clear-history {
            font-size: 12px;
            color: var(--secondary-color);
            background: none;
            border: none;
            padding: 6px 12px;
            cursor: pointer;
            border-radius: 6px;
            transition: all 0.2s ease;
        }

        .clear-history:hover {
            color: var(--error-color);
            background: rgba(244,67,54,0.1);
        }

        .not-video-page {
            text-align: center;
            color: var(--secondary-color);
            font-size: 13px;
            padding: 24px 0;
            background: #fff;
            border-radius: 8px;
            border: 1px dashed var(--border-color);
        }

        .status {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 13px;
            color: #fff;
            background: rgba(0,0,0,0.8);
            z-index: 1000;
            display: none;
            animation: fadeInUp 0.3s ease;
        }

        .status.success {
            background: var(--success-color);
        }

        .status.error {
            background: var(--error-color);
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translate(-50%, 10px);
            }
            to {
                opacity: 1;
                transform: translate(-50%, 0);
            }
        }
    </style>
</head>
<body>
    <div class="section">
        <div class="section-title">快捷键</div>
        <div class="shortcuts">
            <!-- 快捷键内容将由 JavaScript 动态生成 -->
        </div>
    </div>

    <div class="section">
        <div class="section-title">当前视频</div>
        <div id="videoInfo">
            <!-- 这里的内容将由 JavaScript 动态填充 -->
        </div>
    </div>

    <div class="section">
        <div class="section-title">设置</div>
        <div class="settings-grid">
            <div class="setting-item">
                <span class="setting-label">图片格式</span>
                <select id="imageFormat">
                    <option value="png">PNG</option>
                    <option value="jpeg">JPEG</option>
                </select>
            </div>
            <div class="setting-item">
                <span class="setting-label">JPEG 质量</span>
                <select id="jpegQuality" disabled>
                    <option value="0.7">低</option>
                    <option value="0.85">中</option>
                    <option value="1">高</option>
                </select>
            </div>
            <div class="setting-item">
                <span class="setting-label">文件名格式</span>
                <select id="filenameFormat">
                    <option value="title_time">视频标题_时间戳</option>
                    <option value="time_title">时间戳_视频标题</option>
                    <option value="title">仅视频标题</option>
                    <option value="custom">自定义</option>
                </select>
            </div>
            <div class="setting-item" id="customFormatContainer" style="display: none;">
                <input type="text" id="customFormat" placeholder="{title}_{time}_{platform}" style="width: 100%;">
            </div>
        </div>
    </div>

    <div class="section">
        <div class="section-title">
            <span>历史记录</span>
            <button class="clear-history" id="clearHistory">清空</button>
        </div>
        <div class="history-list" id="historyList">
            <template id="historyItemTemplate">
                <div class="history-item">
                    <img class="history-thumbnail" src="${item.dataUrl}" alt="缩略图">
                    <div class="history-info">
                        <div class="history-title">${item.title}</div>
                        <div class="history-time">${formatDate(item.timestamp)}</div>
                    </div>
                    <div class="history-actions">
                        <button class="history-button" data-action="copy" data-index="${index}">复制</button>
                        <button class="history-button" data-action="save" data-index="${index}">保存</button>
                    </div>
                </div>
            </template>
        </div>
    </div>

    <script src="popup.js"></script>
</body>
</html>
